#ifndef HISTOGRAMPREVIEWER_H
#define HISTOGRAMPREVIEWER_H
#include <QWidget>
#include <vector>
#include <map>
#include "ImageInfo.h"



using namespace std;



class HistogramChannel
{
public:

  HistogramChannel (const vector< int > & histogram,
          QColor color, QString channelName, int isShow)
  {
    this->histogram = histogram;
    this->color = color;
    this->channelName = channelName;
    this->isShow = isShow;
  }

  vector< int > histogram;

  QColor color;

  QString channelName;

  bool isShow;

};



class HistogramPreviewer : public QWidget
{

  Q_OBJECT

private:

  int _maxHistogramVal;

  map< QString, HistogramChannel > _channelMap;

  void _generatePreviewData ();

  virtual void paintEvent (QPaintEvent * event);
  virtual void resizeEvent (QResizeEvent * event);
  
public:

  HistogramPreviewer (QWidget *parent = 0);



  bool addChannel (const HistogramChannel & channel);

  bool removeChannel (QString channelName);

  bool setChannelShow (QString channelName, bool isShow);

  void clearChannel ();

};

#endif // HISTOGRAMPREVIEWER_H
